// 创建 store 
import { createStore } from 'redux'
export const ADD = "add"
export const MINUS = "minus"

// 1. 创建 reducer
function reducer(state = { count: 1 }, action) {
  if (action.type === ADD) {
    return { ...state, count: state.count + action.payload }
  }
  if (action.type === MINUS) {
    return { ...state, count: state.count - action.payload }
  }
  return state
}

let store = createStore(reducer)
export default store